<?php


namespace app\admin\controller;


use app\admin\model\ClassifyModel;
use app\admin\services\ClassifyService;
use app\BaseController;
use think\App;

class Classify extends BaseController
{
    protected $middleware=['CheckTokenMiddleware'];
    public function __construct(App $app)
    {
        parent::__construct($app);
    }
    public function index(){
        $p=$this->request->get();
        $data=ClassifyService::tableList($p);
        api_return(200,'',$data);
    }
    public function edit(){
        $p=$this->request->param();
        $p['creator']=$this->request->adminUid;
        ClassifyService::edit($p);
    }
    public function del(){
        $p=$this->request->post();
        ClassifyService::del($p);
    }
    public function createCode(){
        ClassifyService::createSkuCode(ClassifyModel::find(264));
    }
    public function copy(){
        $p=$this->request->post();
        ClassifyService::copy($p);
    }
    public function all(){
        $p=$this->request->get();
        $data=ClassifyService::all($p);
        api_return(200,'',$data);
    }
    public function attr(){
        $p=$this->request->get();
        $data=ClassifyService::attr($p);
        api_return(200,'',$data);
    }
}
